<?php
class Animal {

    private static $_instance = null;
    private function __construct()
    {
    }
    public static function getInstance() {
        if (self::$_instance == null) {
            self::$_instance = new self();
            print_r(1);
        }
        return self::$_instance;
    }

    public function test() {
        echo '动物吃饭';
        return self::$_instance;
    }
    public function test2() {
        echo '动物喝水';
        return self::$_instance;
    }
}

Animal::getInstance()->test()->test2();
